/**
 * 
 */
package ads.engenharia.bl;

import java.sql.SQLException;
import java.util.ArrayList;

import ads.engenharia.dal.ProfessorDAO;
import ads.engenharia.entity.Professor;

/**
 * @author Lanedraex
 *
 */
public class ProfessorBO {

	private ProfessorDAO _professorDAO;

	private boolean checkFields(Professor professor) {

		return false;
	}

	public void save(Professor professor) {

		_professorDAO = new ProfessorDAO();
		try {
			_professorDAO.save(professor);
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	public void delete(Professor professor) {

		_professorDAO = new ProfessorDAO();
		try {
			_professorDAO.delete(professor);
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	public void deleteAll() {

		_professorDAO = new ProfessorDAO();
		try {
			_professorDAO.deleteAll();
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	public void update(Professor professor) {

		_professorDAO = new ProfessorDAO();
		try {
			_professorDAO.update(professor);
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	public Professor search(Professor professor) {

		_professorDAO = new ProfessorDAO();
		try {
			return _professorDAO.search(professor);
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return null;
		}
	}

	public ArrayList<Professor> searchAll() {

		_professorDAO = new ProfessorDAO();
		try {
			return _professorDAO.searchAll();
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return null;
		}
	}

	public Professor searchById(int id) {

		_professorDAO = new ProfessorDAO();
		try {
			return _professorDAO.searchById(id);
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return null;
		}
	}

	public ArrayList<Professor> searchByName(String name) {

		_professorDAO = new ProfessorDAO();
		try {
			return _professorDAO.searchByName(name);
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return null;
		}
	}

	public ArrayList<Professor> searchByCompetence(Object competence) {

		_professorDAO = new ProfessorDAO();
		try {
			return _professorDAO.searchByCompetence(competence);
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return null;
		}
	}

	public ArrayList<Professor> searchByStatus(boolean status) {

		_professorDAO = new ProfessorDAO();
		try {
			return _professorDAO.searchByStatus(status);
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return null;
		}
	}
}
